<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>导航页</title>
    <style>
        html, body {
            height: 100%;
        }

        #head {
            height: 40px;
            margin: 0;
        }

        p {
            font-size: 30px;
            margin: 20px 20px;
            font-family: 楷体;
        }

        #content {
            /*background:#CCCCCC;*/
            height: 200px;
            margin: 20px;
        }

        #left {
            width: 20%;
            height: 200px;
            /*background:#CCCC66;*/
            float: left;
            margin: 0px;
        }

        ul {
            width: auto;
            height: 300px;
            font-size: 20px;
        }

        li {
            width: auto;
            height: 50px;
        }

        a {
            text-decoration: none;
            font-family: 楷体;
        }

        table {
            border-collapse: collapse;
            width: 1100px;
            font-size: 20px;
            font-family: 楷体;

        }

        table, th, td {
            border: 1px solid black;
            text-align: center;
        }

        tr {
            height: 50px;
        }

        input {
            height: 40px;
            margin: 5px 0;
            outline: none;
            border: 1px solid #aaa;
            padding-left: 10px;
            font-size: 14px;
        }

        input[type=submit] {
            width: 100px;
            height: 40px;
            line-height: 40px;
            font-size: 16px;
            background-color: #7b7070;
            border: none;
            color: #fff;
            padding: 0;
            margin: 5px 0;
            cursor: pointer;
        }

        #page {
            float: right;
            margin-right: 80px;
            font-size: 30px;
        }
    </style>
</head>
<body>
<div id="head">
    <p>欢迎${user_name}用户</p>
</div>
<div id="content">
    <div id="left">
        <ul>
            <li>
                <a href="${pageContext.request.contextPath}/emp/show">查看所有员工信息</a>
            </li>
            <li>
                <a href="${pageContext.request.contextPath}/emp/add">添加员工信息</a>
            </li>
            <li>
                <a href="${pageContext.request.contextPath}/user/exit">注销退出</a>
            </li>
            <li>
                <a href="#">首页</a>
            </li>
        </ul>
    </div>
    <div id="c">
        <form action="${pageContext.request.contextPath}/emp/show">
            <input type="text" placeholder="请输入查询员工姓名" name="emp_name">
            <input type="submit" value="查询">
        </form>
        <table id="empList">
            <tr>
                <th>姓名</th>
                <th>性别</th>
                <th>年龄</th>
                <th>部门</th>
                <th>职务</th>
                <th>毕业院校</th>
                <th>学历</th>
                <th>专业</th>
                <th>联系方式</th>
                <th>联系地址</th>
                <th>入职时间</th>
                <th colspan="2">操作</th>
            </tr>
            <c:forEach items="${page.list}" var="emp" varStatus="status">
                <tr>
                    <td>${emp.name}</td>
                    <td>${emp.sex}</td>
                    <td>${emp.age}</td>
                    <td>${emp.dep_name}</td>
                    <td>${emp.duty}</td>
                    <td>${emp.school}</td>
                    <td>${emp.edu}</td>
                    <td>${emp.major}</td>
                    <td>${emp.phone}</td>
                    <td>${emp.address}</td>
                    <td>${emp.entryTime}</td>
                    <%--修改数据：先查后修改--%>
                    <td><a href="${pageContext.request.contextPath}/emp/edit?id=${emp.id}">修改</a></td>
                    <td><a href="${pageContext.request.contextPath}/emp/delete?id=${emp.id}">删除</a></td>
                </tr>
            </c:forEach>
        </table>
    </div>
    <div id="page">
        <%--需要根据页数控制上一页下一页--%>
        <a href="${pageContext.request.contextPath}/emp/page?current=${page.currentPage-1}">上一页</a>
        <a href="${pageContext.request.contextPath}/emp/page?current=${page.currentPage+1}">下一页</a>
    </div>
</div>

</body>
</html>
